package com.bplow.deep.base.mybatis.util;

import com.bplow.deep.base.mybatis.enums.CodeBaseEnum;

public class CodeEnumUtil {

	public static <E extends Enum<?> & CodeBaseEnum> E codeOf(Class<E> enumClass, String code) {
		E[] enumConstants = enumClass.getEnumConstants();
		for (E e : enumConstants) {
			if (e.code().equals(code)) {
				return e;
			}
		}
		return null;
	}

}
